#ifndef __HIKARI_PhysicsMoveKeyb___FILE__DEFINED
#define __HIKARI_PhysicsMoveKeyb___FILE__DEFINED

#include "hikari.h"

class PhysicsMoveKeyb:public BaseHikariScript{
public:
//PLEASE DO NOT MODIFY THIS SECTION
//PROPERTIES_SECTION_START
//PROPERTIES_SECTION_END

    //virtual void sceneLoaded(HObj*object, HikariContext*context){}
	//virtual void sceneUnloading(HObj*object, HikariContext*context){}
	virtual void update(HObj*object, HikariContext*context){
		float speed=0.3f;
		btRigidBody*body=((BulletPhysicsHComponent*)object->getRenderComponent(L"bulletPhysics"))->getRigidBody();
		body->setGravity(btVector3(0,0,0));
		if(context->getInput()->IsKeyDown(KEY_UP)){
			btMotionState*mste=body->getMotionState();
			btTransform tr; 
			tr=body->getWorldTransform();
			tr.setOrigin(tr.getOrigin()+btVector3(0,speed,0));
			body->setWorldTransform(tr);
			mste->getWorldTransform(tr);
			tr.setOrigin(tr.getOrigin()+btVector3(0,speed,0));
			mste->setWorldTransform(tr);			
		}

		if(context->getInput()->IsKeyDown(KEY_DOWN)){
			btMotionState*mste=body->getMotionState();
			btTransform tr; 
			tr=body->getWorldTransform();
			tr.setOrigin(tr.getOrigin()+btVector3(0,-speed,0));
			body->setWorldTransform(tr);
			mste->getWorldTransform(tr);
			tr.setOrigin(tr.getOrigin()+btVector3(0,-speed,0));
			mste->setWorldTransform(tr);
		}
	}
    
	IMPLEMENT_RTTI(PhysicsMoveKeyb, BaseHikariScript);
};

BEGIN_REFLECTION_METADATA(PhysicsMoveKeyb, base_rtti_object)
END_REFLECTION_METADATA(PhysicsMoveKeyb)
#endif